package server;


import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import logic.Game;

public class Server {
	
	private static final int PORT = 8888;
	
	public static void main(String[] args) {
		ActiveSessions activeSessions = new ActiveSessions();
		OutboundMessages obm = new OutboundMessages();
		
		new Broadcaster(activeSessions, obm);
		
		ServerSocket server;
		try {
			server = new ServerSocket(PORT);
		System.out.println("Server pordil " + PORT + " startis.");
		Game game = new Game();
			while(true){
				try{
				Socket socket = server.accept();
				new ClientSession(socket, activeSessions, obm);
				}
				catch(IOException e){
					System.out.println("Error: " + e);
				}
			}
			
			
		}
		catch(IOException e1){
			System.out.println("Error: " + e1);
		}
		
	}

}
